#define _CRT_SECURE_NO_WARNINGS 1
#include <iostream>
#include <vector>

using namespace std;

class animal
{
public:
	virtual void run() = 0;
	virtual void eat() = 0;
	virtual ~animal() {}
};

class cat : public animal
{
public:
	virtual void run() override
	{
		cout << "cat is running" << endl;
	}

	virtual void eat() override
	{
		cout << "cat is eating" << endl;
	}

	~cat()
	{
		cout << "~cat()" << endl;
	}
};

class dog : public animal
{
public:
	virtual void run() override
	{
		cout << "dog is running" << endl;
	}

	virtual void eat() override
	{
		cout << "dog is eating" << endl;
	}
};

class abstractFactory
{
public:
	virtual animal* build() = 0;
};

class catFactory : public abstractFactory
{
public:
	virtual animal* build() override
	{
		return new cat;
	}
};

class dogFactory : public abstractFactory
{
public:
	virtual animal* build() override
	{
		return new dog;
	}
};

int main()
{
	abstractFactory* abs = new catFactory;
	animal* ani = abs->build();
	ani->eat();
	ani->run();

	return 0;
}